package managers.strategy;

import managers.HallCallManager;
import state.group.HallCall;

/**
 * This class is the base class for all of the Strategies 
 * that will be used to assign Hall Calls to Elevators.
 * 
 * This class is not meant to perform the actual assigning/resolving of Hall Calls,
 * but merely to determine where hall calls should go.
 * 
 * If you want to actually make changes, I suggest using manager.registerHallCall and
 * manager.resolveHallCall.  Keep in mind that these methods will cause assignHallCall and
 * resolveHallCall to be run, meaning it would be best to only use these methods inside of 
 * verifyHallCalls.  Otherwise, recursion errors could easily occur.
 * 
 * @author Ian Doerr
 */
public abstract class HallCallStrategy {
    
    protected HallCallManager manager = null;
    
    /**
     * Save a reference to the HallCallManager
     * 
     * @param manager
     */
    public void setManager(HallCallManager manager)
    {
        this.manager = manager;
    }
    
    /**
     * Determine which elevator this Hall Call should be assigned to
     * 
     * @param call
     * @return elevator id
     */
    public abstract Byte assignHallCall(HallCall call);
    
    /**
     * Release any resources related to this hall call
     * 
     * @param call
     */
    public abstract void resolveHallCall(HallCall call);
    
    /**
     * Check the list of hall call assignments, and determine if any hall calls
     * should be re-assigned.
     */
    public abstract void verifyHallCalls();
    
}
